package com.xuchaotong.utils;

import org.junit.Test;
import java.math.BigDecimal;

public class MathDemo {

    @Test
    public void test() {
        BigDecimal pay = new BigDecimal("299.00");
        Integer proportion = 1;
//        BigDecimal p = pay.multiply(BigDecimal.valueOf((float) proportion / 100));
        BigDecimal p = pay.multiply(BigDecimal.valueOf(proportion)).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
        long lp = p.setScale(0, BigDecimal.ROUND_DOWN).longValue();

        System.out.println(lp);
    }
}
